import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  server: {
    open: true,
    proxy: {
      /**
          * /aaa 代理标识
          * /aaa 代表 http://139.224.163.17 
          */
      '/aaa': {
        // 代理地址
        target: 'http://139.224.163.17',
        changeOrigin: true,
        /**
         * 如果不把/aaa 变成空 
         * http://139.224.163.17/aaa/api/admin/base/open/login
         * @param {} path 
         * @returns 
         */
        rewrite: (path) => path.replace(/^\/aaa/, ''),
      },
      '/bbb': {
        // 代理地址
        target: 'http://47.93.246.252:7001',
        changeOrigin: true,
        /**
         * 如果不把/aaa 变成空 
         * http://139.224.163.17/aaa/api/admin/base/open/login
         * @param {} path 
         * @returns 
         */
        rewrite: (path) => path.replace(/^\/bbb/, ''),
      },
    }

  }
})
